package o;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.LinearLayout;
import o.dex.a;

public abstract class bhx extends bgz {
    private LinearLayout ˊ;
    private View ˋ;
    private int ˎ;
    private final fai ˏ;

    protected abstract void ˋ(View view);

    public abstract int ˎ();

    protected abstract int ॱ();

    bhx(Context context, fai o_fai) {
        ˊ(context);
        this.ˏ = o_fai;
    }

    public View ˋॱ() {
        this.ˋ = LayoutInflater.from(ˉ()).inflate(ॱ(), null);
        this.ˊ = (LinearLayout) this.ˋ.findViewById(beo$e.ᶥ);
        ˏ();
        ˋ(this.ˋ);
        return this.ˋ;
    }

    public void A_() {
        if (Logger.ˎ()) {
            Logger.ˏ("AbsHelpSegment", "onOrientationChanged");
        }
        super.A_();
        ˏ();
    }

    private void ˏ() {
        ˎ(this.ˊ);
        ˊ(this.ˋ);
    }

    private void ˎ(View view) {
        int ˋॱ = this.ˏ.ˋॱ();
        Context ˋ = ContentManager.getInstant().getContext();
        int rotation = this.ˏ.ˎ(ˋ).getDefaultDisplay().getRotation();
        if (fam.ॱ().ॱॱ()) {
            if (rotation == 1 && this.ˏ.ᐝॱ() == a.ˏ) {
                ˋॱ -= epv.ˋ(ˋ);
            } else if (rotation == 3 && this.ˏ.ᐝॱ() == a.ˋ) {
                ˋॱ -= epv.ˋ(ˋ);
            }
        }
        if (fam.ॱ().ᐝ() && (rotation == 0 || rotation == 2)) {
            ˋॱ -= epv.ˋ(ˋ);
        }
        this.ˎ = ˋॱ;
        LayoutParams layoutParams = view.getLayoutParams();
        layoutParams.width = ˋॱ;
        layoutParams.height = this.ˎ;
    }

    private void ˊ(View view) {
        ImageView imageView = (ImageView) view.findViewById(beo$e.ﾟ);
        float ˎ = ˎ(ˎ());
        LayoutParams layoutParams = imageView.getLayoutParams();
        int ʼ = ʼ();
        layoutParams.height = ʼ;
        layoutParams.width = (int) (((float) ʼ) / ˎ);
    }

    private float ˎ(int i) {
        if (ˉ() == null) {
            Logger.e("AbsHelpSegment", "context == null, return default ratio : 1");
            return 1.0f;
        }
        Drawable drawable = ˉ().getResources().getDrawable(i);
        return (1.0f * ((float) drawable.getIntrinsicWidth())) / ((float) drawable.getIntrinsicHeight());
    }

    private int ʼ() {
        return this.ˎ;
    }
}
